/**
 *			\author ITII - ISEN - P6
 *			\author Benjamin Mur
 *			\file Main.cpp
 *			\version 0.2
 *			\date 10/09/2010
 */

#include <iostream>
#include "TcpServer.h"
#include "SmtpServer.h"
#include "Mail.h"
#include "MailArchiver.h"

using namespace std;

int main(void)
{
	SmtpServer	smserv(25);
	Mail		mail;

	if( false == smserv.isInit() )
		return -1;

	cout << "Waiting for a mail..." << endl;

	mail = smserv.receiveMail();

	if( true == smserv.isFillOut() )
	{
		cout << "Mail received!" << endl;
		MailArchiver::saveMail(mail);
	}
	else
	{
		cerr << "No mail received!" << endl;
		return -1;
	}

	return 0;
}
